<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>Document</title>
	</head>
	<body>
		<script type="text/javascript">
			//补全字符串
			let str1='x'.padStart(5,'ab');
			console.log(str1);//'ababx'
			
			let str2='x'.padStart(4,'ab');
			console.log(str2);//'abax'
			
			let str3='x'.padEnd(5,'ab');
			console.log(str3);//'xabab'
			
			let str4='x'.padEnd(4,'ab');
			console.log(str4);//'xaba'
			
			//消除空格
			const s=`	welcome		`;
			console.log(s.trim());//"welcome"
			console.log(s.trimStart());//"welcome	"
			console.log(s.trimEnd());//"	welcome"
			
			//返回指定位置字符串
			const str = 'hello';
			console.log(str.at(1));//"e"
			console.log(str.at(-1));//"o"
		</script>
	</body>
</html>